<template>
	<div class="shandongdianxin" style="padding: 20px;">
		<div style="display: flex; margin-bottom: 20px;">
			<el-date-picker v-model="time"  value-format="yyyy-MM-dd" style="margin-right: 20px;" type="datetime"></el-date-picker>
			<el-button type="primary" @click="daochu()" >导出</el-button>
		</div>
		<div style="display: flex;">
			<el-input style="width: 250px; margin-right: 20px;" v-model="id" placeholder="先输入ID"></el-input>
			<el-input style="width: 250px; margin-right: 20px;" v-model="mobile" placeholder="先输入手机号"></el-input>
			<el-button type="primary" @click="getlist()" >搜索</el-button>


		</div>
		<div style="padding: 30px 0;">
			<div v-for="(item,index) in content" :key="index" style="font-size: 20px; margin-bottom: 10px;">
				{{index}}:{{item}}
			</div>
		</div>
	</div>
</template>

<script>
	import axios from 'axios'
	export default {
		name: 'shandongdianxin',
		data() {
			return {
				id:"",
				mobile:"",
				content:"",
				time:"",
				url:""
			}
		},
		watch: {

		},
		computed: {

		},
		created() {
			this.getlist()
		},
		methods: {
			daochu:function(){
				axios.get("/api/tool/sddx/export?date="+this.time)
					.then(response => {
						if (response.data.msg.code == 0) {
							if (window.location.href.indexOf("91haoka_platform") > -1) {
								console.log("线上项目，谨慎操作。")
								this.url = window.location.origin + "/"
							} else {
								this.url = ""
							}
							var a = document.createElement('a');
							a.setAttribute('href', this.url + response.data.data);
							a.click();
						} else {
							this.$message.error(response.data.msg.info);
						}
					})
			},
			//获取全部活动
			getlist:function(){
			    var that = this
			    axios.get('/api/ROS/sddx/info2?id='+this.id+'&mobile='+this.mobile)
			    	.then(response => {
			          if(response.data.msg.code == 0){
                  this.content = response.data.data
                  for(let i in this.content){
                    console.log(i,this.content[i])
                  }
			          }else{
                  this.$message.error(response.data.msg.info);
                }
			    	})
			},


		},

	}
</script>

<style scoped>
	.shandongdianxin {

	}
</style>
